package teach.aistar.mapper;

import org.apache.ibatis.annotations.*;
import teach.aistar.model.entity.CarCart;

import java.util.List;

public interface CarCartMapper {

    @Select("select * from car_cart")
    List<CarCart> selectAll();

    int saveCard(CarCart carCart);

//    @Select("select * from cart_cart where product_id=#{productId} and u_id=#{userId}")
//    CarCart find(@Param("productId") Integer productId, @Param("userId") Integer userId);




    @Select("select * from car_cart where user_id=#{value}")
    List<CarCart> findAll(Integer uId);

    @Delete("delete from car_cart where id=#{value}")
    int deleteById(Integer id);

    @Update("update car_cart set counts = counts+1,total=ca_price*counts where id=#{id} and user_id=#{userId}")

    int updates(Integer id,Integer counts);
}
